#This script can be used to "un-cluster" a box. useful for cluster creation development testing.

#!/bin/bash

#stop services
#service cman stop

#chkconfig off services
chkconfig cman off
chkconfig fenced off
chkconfig rgmanager off

#chkconfig on services
chkconfig iptables on

#restore selinux
rm /etc/selinux/config
mv /etc/selinux/selinux.config.backup.clusterinstall /etc/selinux/config

#erase the cluster packages
yum grouperase Clustering "Cluster Storage"

#restore hosts file
echo -e "# Do not remove the following line, or various programs\n# that require network functionality will fail.\n127.0.0.1\t\tlocalhost.localdomain localhost\n::1\t\tlocalhost6.localdomain6 localhost6\n" >> /etc/hosts

#Delete luci database
rm -rf /var/lib/luci
rm -rf /etc/cluster/*

#reboot!
init 6
